Robotics 1.0
Lesson 2 :Hello CPX.

Purpose: Students will learn how to connect the CPX, control an LED using code, and save the program as code.py on CIRCUITPY

No. of. Classes

1 - 1 (Time : 1 hour and 30 minutes; each group has a maximum of 2 students).

Materials Required
  • CPX(Arduino board).

  • USB cable

Prior knowledge

Familiarity with Circuit Playground Express (CPX)
Knowledge on Variables in python
Boot CPX in Circuit Python mode

Exercises



Exercise:1



Blink the Neopixel at index 0

Click here to view the instructions and code

Exercise:2



Introduction to Conditional Statements

Click here to view the instructions and code

Exercise:3



LED Blink Program using Conditional Statements and Looping Structures

Click here to view the instructions and code

Solution



  • Click here to see the solution video for Exercise 1
  • Click here to see the solution video for Exercise 3
  • Teacher's Instruction
    1. Ensure every student can connect the CPX board and open Mu Editor.
    2. Demonstrate a basic LED blink example and explain each line of code.
    3. Introduce if-else logic by showing how LED behavior changes when a button is pressed.
    4. Guide students to add loops to make the LED blink repeatedly.
    5. Encourage students to modify delay values or LED indices for creativity.
    6. Learn more about CPX here.
    7. In cp.pixels[0], what does the number 0 represent? Ask the students to try cp.pixels[20] and observe what happens. Discuss the output.